package pers.lx.crm.controller.business;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import pers.lx.crm.base.common.pigeon.Result;
import pers.lx.crm.entiy.business.BusinessDO;
import pers.lx.crm.entiy.business.BusinessListDO;
import pers.lx.crm.service.business.BusinessService;

/**
 * Created by lxl on 2017/3/8.
 */
@Controller
@RequestMapping(value = "business")
public class BusinessController {

    @Autowired
    private BusinessService businessService ;

    @RequestMapping(value = "/list")
    public @ResponseBody
    Result getBusinessList(BusinessDO businessDO){
        return businessService.getBusinesses(businessDO) ;
    }

    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public @ResponseBody
    Result addBusiness(@RequestBody BusinessDO businessDO){
        Result result = businessService.addBusiness(businessDO) ;
        return result ;
    } ;

    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public @ResponseBody
    Result updateBusiness(@RequestBody BusinessDO businessDO){
        Result result = businessService.updateBusiness(businessDO) ;
        return  result ;
    }

    @RequestMapping(value = "/remove",method = RequestMethod.POST)
    public @ResponseBody
    Result removeBusiness(@RequestBody BusinessListDO listDO){
        Result result = businessService.removeBusinesses(listDO.getBusinessDOs()) ;
        return  result ;
    }

    @RequestMapping(value = "/listFlow",method = RequestMethod.POST)
    public @ResponseBody
    Result listFlow(@RequestBody BusinessDO businessDO){
        Result result = businessService.getFlows(businessDO) ;
        return  result ;
    }

}
